﻿using MiniFox.Components;
using MiniFox.Platform.Models;
using MiniFox.Platform.OAuth2.Configurations;
using MiniFox.Platform.OAuth2.Services;

namespace MiniFox.Platform.OAuth2
{
    /// <summary>
    /// 授权令牌服务
    /// </summary>
    [AutoRegister, SpareComponent(typeof(AccessTokenService))]
    public interface IAccessTokenService
    {
        /// <summary>
        /// 
        /// </summary>
        AccessTokenConfiguration Configuration { get; }
        /// <summary>
        /// 通过授权码创建令牌
        /// </summary>
        /// <param name="appId"></param>
        /// <param name="secretKey"></param>
        /// <param name="authCode"></param>
        /// <returns></returns>
        AuthorizeToken CreateAuthorizeToken(string appId, string secretKey, string authCode);
        /// <summary>
        /// 获取用户身份
        /// </summary>
        /// <param name="accessToken"></param>
        /// <returns></returns>
        OpenAuthIdentity GetIdentity(string accessToken);
        /// <summary>
        /// 刷新令牌
        /// </summary>
        /// <param name="appId"></param>
        /// <param name="secretKey"></param>
        /// <param name="refreshToken"></param>
        /// <returns></returns>
        AuthorizeToken RenewAuthorizeToken(string appId, string secretKey, string refreshToken);
        
    }
}